{# @var assets \EasyCorp\Bundle\EasyAdminBundle\Dto\AssetDto[] #}
{% for js_asset in assets %}
    {% if js_asset.preload %}
        {% guard function preload %}
            {% set src = asset(js_asset.value, js_asset.packageName) %}
            <script src="{{ preload(src, {as: 'script', nopush: js_asset.nopush}) }}" {{ js_asset.async ? 'async' }} {{ js_asset.defer ? 'defer' }}
            {%- for attr, value in js_asset.htmlAttributes %} {{ attr }}="{{ value|e('html') }}"{% endfor %}></script>
        {% endguard %}
    {% else %}
        <script src="{{ asset(js_asset.value, js_asset.packageName) }}" {{ js_asset.async ? 'async' }} {{ js_asset.defer ? 'defer' }}
        {%- for attr, value in js_asset.htmlAttributes %} {{ attr }}="{{ value|e('html') }}"{% endfor %}></script>
    {% endif %}
{% endfor %}
